package com.zhou.basics.common.enums;

import javax.swing.*;

public enum ResultCode {
    /**
     * 成功
     */
    SUCCESS(200,"OK"),
    FAIL(400,"FAIL"),
    UNAUTHORIZED(401,"Unauthorized"),
    NOT_FOUND(404,"NotFound"),
    INTERNAL_SERVER_ERROR(500,"internalServerError")
    ;

    public int code;
    public String msg;
    ResultCode (int code,String msg){
        this.code=code;
        this.msg=msg;
    }

    public static ResultCode getResultCode(String msg){
        for (ResultCode checkResult : ResultCode.values()){
            if (checkResult.msg.equals(msg)){
                return checkResult;
            }
        }
        return null;
    }

}
